package step1_homework4_01;

import java.util.List;
import java.util.Scanner;

public class Student_update {
    public static List stu_up(List list) throws AgeException {
        System.out.println("请输入要修改学生的id：");
        Scanner sc =new Scanner(System.in);
        int id = sc.nextInt();
        for (int i = 0; i <list.size() ; i++) {
            Student o = (Student) list.get(i);
            if (o.getId().equals(id)){
                System.out.println("请输入要修改的age :");
                o.setAge(sc.nextInt());
                System.out.println("请输入要修改的name :");
                o.setName(sc.next());
            }else {
                System.out.println("系统中不存在此学生信息！！！！");
            }

        }
        return list;
    }
}
